{% extends 'base.html' %}
{% load i18n %}

{% block head %}
  <link href="{{ STATIC_URL }}css/feeds.css" rel="stylesheet">
  <script src="{{ STATIC_URL }}js/jquery.bullseye-1.0-min.js"></script>
  <script src="{{ STATIC_URL }}js/feeds.js"></script>
{% endblock head %}

{% block nav %}
  <li class="active"><a href="{% url 'feeds' %}">{% trans 'Feed' %}</a></li>
  <li><a href="{% url 'articles' %}">{% trans 'Articles' %}</a></li>
  <li><a href="{% url 'questions' %}">{% trans 'Q&A' %}</a></li>
  <li><a href="{% url 'about' %}">{% trans 'About'%}</a></li>
{% endblock nav %}

{% block main %}
  <div class="page-header">
    <h1>我的订单</h1>
  </div>
    <table class="table table-striped" style="text-align:center; vertical-align:middle">
      <tr>
        <th style="text-align:center; vertical-align:middle">订单号</th>
        <th style="text-align:center; vertical-align:middle">下单日期</th>
        <th style="text-align:center; vertical-align:middle">店铺</th>
        <th style="text-align:center; vertical-align:middle">订单内容</th>
        <th style="text-align:center; vertical-align:middle">订单状态</th>
        <th style="text-align:center; vertical-align:middle">操作</th>
      </tr>
{% for order in orders %}
      <tr>
        <td>{{ order.id }}</td>
        <td><i>{{ order.date | date:"Y-m-d H:i:s" }}</i></td>
        <td><i>{{ order.shop.name }}</i></td>
        <td><i>{{ order.content }}</i></td>
        <td><i>
{% ifequal order.status 0 %}
下单成功，等待商家确认
{% endifequal %}
{% ifequal order.status 1 %}
商家已确认
{% endifequal %}
{% ifequal order.status 2 %}
订单已完成
{% endifequal %}
{% ifequal order.status 3 %}
订单已取消
{% endifequal %}
        </i></td>
{% ifequal order.status 0 %}
        <td>
          <form action="/market/delete_order/" method="POST">
{% csrf_token %}
            <input type="hidden" name="orderid" value="{{ order.id }}">
            <button type="submit" class="btn btn-primary btn-xs" data-toggle="tooltip"data-placement="bottom" title="删除订单">取消订单</button>
          </form> 
        </td>
{% endifequal %}
      </tr>
{% endfor %}
    </table>
{% endblock main %}
